package com.peanut.youfupay.service.other;


import com.alibaba.fastjson.JSON;
import com.peanut.youfupay.entity.request.Payment;
import com.peanut.youfupay.entity.response.PlaceOrderRes;
import com.peanut.youfupay.entity.response.ResponseMessage;
import com.peanut.youfupay.enums.FunCodeEnum;
import com.peanut.youfupay.service.BaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 商户批量下单
 */
@Slf4j
@Service("placeOrderService")
public class PlaceOrderService extends BaseService {
    /**
     * @param funCodeEnum
     * @param payment
     * @return
     * @throws Exception
     */
    public PlaceOrderRes doBusiness(FunCodeEnum funCodeEnum, Payment payment) {
        log.info("下单开始:{}，{}", funCodeEnum, payment);
        ResponseMessage responseMessage = applyYouFuByHttpPost(funCodeEnum, payment);
        PlaceOrderRes placeOrderRes = JSON.parseObject(responseMessage.getResData(), PlaceOrderRes.class);
        log.info("下单结束:{}", placeOrderRes);
        return placeOrderRes;
    }
}





